package com.xing.controller;

import com.xing.Utils.Result;
import com.xing.dto.ChatHistoryDTO;
import com.xing.dto.ChatUserDTO;
import com.xing.service.ChatHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @version 1.0
 * @Author Xing
 * @Date 2024/4/25 13:08
 */
@Tag(name = "聊天记录")
@RestController
@RequestMapping("chatHistory")
public class ChatHistoryController {
    @Autowired
    private ChatHistoryService service;

    @Operation(summary = "根据好友id查询聊天记录")
    @GetMapping("chatHistory")
    public Result getChatHistory(@RequestParam("attentionedId") Long attentionedId,@RequestParam("limit") Integer limit) {
        List<ChatHistoryDTO> list = service.getChatHistory(attentionedId,limit);
        return new Result().ok(list);
    }


    @Operation(summary = "查询谁给我发消息了")
    @PostMapping("chatUserList")
    public Result GETChatUser(){
        List<ChatUserDTO> list = service.getChatUser();
        return new Result().ok(list);
    }

}
